import actions from '@/store/modules/login/login';
import { RootState } from '@/store/rootReducer';
import React from 'react';

import { useHistory } from 'react-router-dom';
import { useSelector, shallowEqual, useDispatch } from 'react-redux';

export default function LoginPage() {
  const dispatch = useDispatch();

  const history = useHistory();

  const LoginStore = useSelector(
    (state: RootState) => state.LoginReducer,
    shallowEqual
  );

  function clickMe() {
    dispatch(actions.setLogin({ status: true }));
    history.push('/document');
  }

  return (
    <div className="login-page" onClick={clickMe}>
      登录-{LoginStore.login}
    </div>
  );
}
